package ${rootPkg}.service.${modelName}.${entityVar};

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.bitkit.basic.annotation.ServiceTag;
import cn.bitkit.component.BaseService;
import cn.bitkit.component.IdHelper;

import ${rootPkg}.pojo.dto.${modelName}.${entityVar}.${entityName}AddReq;
import ${rootPkg}.pojo.dto.${modelName}.${entityVar}.${entityName}AddResp;
import ${rootPkg}.pojo.entity.${modelName}.${entityName};
import ${rootPkg}.mapper.${modelName}.${entityName}Mapper;

@Service
@ServiceLabel("${entityVar}Add")
public class ${entityName}AddService implements BaseService<${entityName}AddReq, ${entityName}AddResp> {

    @Autowired
    ${entityName}Mapper ${entityVar}Mapper;

    @Override
    public ${entityName}AddResp execute(${entityName}AddReq req) {
        ${entityName} entity = new ${entityName}();
        BeanUtils.copyProperties(req, entity);
        entity.set${primaryKeyUpper}(IdHelper.getId());
        ${entityVar}Mapper.insert(entity);
        ${entityName}AddResp resp = new ${entityName}AddResp();
        return resp;
    }

}